package sy.model.base;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "trole", catalog = "")
public class Trole implements java.io.Serializable {

	private String id;
	private Tcompany tcompany;
	private Trole trole;
	private Date created;
	private String name;
	private boolean systemdata;
	private Date updated;
	private Set<TuserTrole> tuserTroles = new HashSet<TuserTrole>(0);
	private Set<Trole> troles = new HashSet<Trole>(0);

	public Trole() {
	}

	public Trole(String id, Date created, String name, boolean systemdata, Date updated) {
		this.id = id;
		this.created = created;
		this.name = name;
		this.systemdata = systemdata;
		this.updated = updated;
	}

	public Trole(String id, Tcompany tcompany, Trole trole, Date created, String name, boolean systemdata, Date updated, Set<TuserTrole> tuserTroles, Set<Trole> troles) {
		this.id = id;
		this.tcompany = tcompany;
		this.trole = trole;
		this.created = created;
		this.name = name;
		this.systemdata = systemdata;
		this.updated = updated;
		this.tuserTroles = tuserTroles;
		this.troles = troles;
	}

	@Id
	@Column(name = "id", unique = true, nullable = false, length = 36)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "tcompany_id")
	public Tcompany getTcompany() {
		return this.tcompany;
	}

	public void setTcompany(Tcompany tcompany) {
		this.tcompany = tcompany;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "trole_id")
	public Trole getTrole() {
		return this.trole;
	}

	public void setTrole(Trole trole) {
		this.trole = trole;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created", nullable = false, length = 19)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Column(name = "name", nullable = false, length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "systemdata", nullable = false)
	public boolean isSystemdata() {
		return this.systemdata;
	}

	public void setSystemdata(boolean systemdata) {
		this.systemdata = systemdata;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "updated", nullable = false, length = 19)
	public Date getUpdated() {
		return this.updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "trole")
	public Set<TuserTrole> getTuserTroles() {
		return this.tuserTroles;
	}

	public void setTuserTroles(Set<TuserTrole> tuserTroles) {
		this.tuserTroles = tuserTroles;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "trole")
	public Set<Trole> getTroles() {
		return this.troles;
	}

	public void setTroles(Set<Trole> troles) {
		this.troles = troles;
	}

}
